require("base_proto")

--------------------------Package--------------------------
module ("pop3" , package.seeall)
--------------------------command list definition--------------------------
local cmd_list ={
"user",
"pass",
"retr",
"list",
"uidl",
"noop",
"stat",
"top",
"dele",
"rset",
"quit",
"capa",
"auth",
"stls",
"xtnd",
"apop"
}
--------cmd sequence conf,surport pipeline--------
cmd_seq = {
{"banner"},
{"user"},
{"pass"},
{"retr"},
{"quit"},
}
---------------------------------------------------------


------------------------cmd conf----------------
cmd_conf = {
	["banner"]= {{base_proto.get_data, {"banner\r\n"}}, 
				{base_proto.get_data, {"+OK pop3 server ready.\r\n"}}},
				
	["user"] = {{base_proto.get_data, {"user lius\r\n"}}, 
				{base_proto.get_data, {"+OK user ok\r\n"}}},
				
	["pass"] = {{base_proto.get_data, {"pass lius\r\n"}}, 
				{base_proto.get_data, {"+OK pass ok\r\n"}}},
				
	["retr"] = {{base_proto.get_data, {"retr 1\r\n"}}, 
				{base_proto.get_data, {"+OK retr ok\r\n", "/home/lius/workspace/conf_itf/mail_001.eml", "\r\n.\r\n"}}},
				
	["list"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["uidl"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["noop"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["stat"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["top"]  = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["dele"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["rset"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["quit"] = {{base_proto.get_data, {"quit\r\n"}}, 
				{base_proto.get_data, {"+OK quit ok\r\n"}}},
				
	["capa"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["auth"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["stls"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["xtnd"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["apop"] = {{base_proto.get_data, {args}}, 
				{base_proto.get_data, {args}}},
				
	["ukwn"] = {{base_proto.get_data, {"ukwn abc\r\n"}}, 
				{base_proto.get_data, {"-ERR Invalid command.\r\n"}}},
}

cmd_split = "[ \t\r\n]"
line_split = "\r\n"
